package com.spboot.controller;


import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016101900720658";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCpNk1Mh1Fgkjm8ndGtqoIhck1cRJT6qiayDShBzA0CdvK9hDJf9Iv1Peti6mvk31ytyWP0Bbp+xYiHW48HjYQEttR5EJ2cOF+Ruc7tFb5AGOUB29JAN0mB0yZ42wwt8D1BwUpPZ0IAI3M3Qn1fCJ1M7OLxefB6L6eEjHpqXxnq3ewo3Rv/HL0H/cTd3I9lw6GA8IzLfAm5qrdymuntuJIumEOHIF9GGy8sI51fEdkUZKHo2D4DFcsGmN+aoh9/k0jIarIPtrAswxyG5b1busUJtUAMzJrb+Bw2LQb1SmjVzS0K3abr30Nhg/Zwp+1w2ZnLjrpGphkZZ/+t0TBYRysvAgMBAAECggEAV3vOrSFM7mvLU/wYOvxruRUab/i5OXuc8/MffB0eIMcUquzdCoUpkwqHVyWx0Ku2g9caSUBo8j/4XVr18Ma2maVY5pqzkeAHcRUqqaLTMNpuE+7tneu3olpjippdiqapVQS1AaZ2FhI98DT9EpQml23ly0jrDpDyv/HNHI+8m5N3a+h6bU5YtCxaUYVpU99vEO8dQFUY2dEvel0wR2KcE3d4957hdN85c1hL43sOoh0xjhU22nq1jxVwTR/dVZmmyEIqVq509r+iIAWjKf79/+XW9IZJ34LhWYLRx0D27WHRu5vuC17GzpmDGOIJpkjqVVbFsQmdyDILowlmpcfNoQKBgQDd+KEHfXS0oNEIIsOHLPiI28xbMkzC6FbxppNMJd0Mo8xejVDhMGlXtsI0eq5PLeKVdAymwpFNLgHzsT7u0vnABMzqOuQd3wP7g4VergdGY3sqIHxAZE8NYLBMc2PLxPxUh5LWhpRLVW6zv6sMZ39A0lnzrqmuBc6bW2hmXXcPvwKBgQDDJx22Xh//YMCR+7ikLbI9Symh2nIYZdvZ1lxK4s0KwET/MUDWlUkLr01dDARyBibAZsBi+ntwnjtHbwTN8bOexCNXNDf9jwsjKVoLZ9HpsArnOGj/ArwVYatGdpuA+sdRSGpcShZQXfs2NPMZK7nMRlDd1ehnxMo9J28R5fjAkQKBgQDRHUMvGDzTUlG7FW0ZMv+th0x9eeShFluaarCH43/dQY7uYLmafI4xiUZqRE1k4Lh+zgaBL/nNOROzrf645d9Ny/f0jqiLj6dj0qLZ8J9/64aDyHjl/NoQo09Tpr2Uoa6KP/LQ0ZZxZjnVczNEi1hyC/mcPacy/9uFttai4ViiZwKBgHJqAYKFBq978wrjkOo4nFJROdRZtSDWvyGlCrEg7WPLO+h94Oyt04iVO38853JOZvPQiiS9hBePvWNxFFkFxvBjP/EFfXocHkR8Hv2m3avreUj8ippP6SOEAp2qNhtVa/wcv7bh/NkbcIfkXU45k5HO++RDYCFOf9+Auh69PKzxAoGBANdb03NwQ15BTS7zlkkDfj48q8aDAT64KzcoEX35n+1J8NaOhmCjQrpISQDSSgtHrY2YZtmqUzY4XsJ3Dfgg/f9zYXleAlXW2I0UNf3N3u5X3O1vnrFqPixCSA0f1fkF10GrhGEPZmI0rxXrNKx8sW00cJfy2nIoLV1S9MLQlv97";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArxNVATnJKRiBXFy+RdAflL/DYhweoIdLzz5fTkfmXlv25mg058FSH1MCf9dBI2k8ANLsA/oz9OCW5jw2HNvIxp2W3Vu93iNNT1iz605LqQIAP7qLRSA5fCf0136W4Zxk0fzTrPj+cNkuVdCt10CrAnxSNAdknlwog1iwEjg/ea1v/v3TpPbhDzocyJd1Gq0QUPY992VlJmaL1OKy107SR0/CB/G+tTbhmI5n5z5oaIS23NFpjJioIg2b86fS7vrcEp57UAQilBvxnCviAQ4m2TZ8TBY/Fjwl8+uYbMVgBFeN7k2CWhHiw1NDuWbHIvSHD7POqdmOgHKvIpVx3+/uHQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8088/information/orderadd";//trade_no

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8088/information/orderadd";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

